import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/fonts.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/model/balance.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 余额明细
///
///
class BalanceInfo extends StatefulWidget {
  const BalanceInfo({Key? key}) : super(key: key);

  @override
  State<BalanceInfo> createState() => _BalanceInfoState();
}

class _BalanceInfoState extends State<BalanceInfo> {
  late BalanceDetailModel balance;

  @override
  void initState() {
    super.initState();
    balance = Get.arguments as BalanceDetailModel;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: ToolsUtils.getDefaultBrnAppBar(
        '余额明细',
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(top: Sizes.default30),
              alignment: Alignment.center,
              child: Text(
                balance.payName,
                style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
              ),
            ),
            Container(
              margin: const EdgeInsets.only(top: Sizes.default20, bottom: Sizes.default15),
              alignment: Alignment.center,
              child: Text(
                '${balance.payAmount > 0 ? '+${balance.payAmount}' : balance.payAmount}',
                style: StylesUtils.customTextStyle(
                    color: balance.type.textColor, fontSize: Sizes.default20, fontWeight: Fonts.w7),
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              height: Sizes.default40,
              child: Row(
                children: [
                  Expanded(
                    flex: 3,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      padding: const EdgeInsets.only(left: Sizes.default30),
                      child: Text(
                        '类型',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 5,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      child: Text(balance.type.text, style: StylesUtils.customTextStyle(color: ColorsUtils.color797),),
                    ),
                  )
                ],
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              height: Sizes.default40,
              child: Row(
                children: [
                  Expanded(
                    flex: 3,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      padding: const EdgeInsets.only(left: Sizes.default30),
                      child: Text(
                        '创建时间',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 5,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      child: Text(balance.payTime, style: StylesUtils.customTextStyle(color: ColorsUtils.color797),),
                    ),
                  )
                ],
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              height: Sizes.default40,
              child: Row(
                children: [
                  Expanded(
                    flex: 3,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      padding: const EdgeInsets.only(left: Sizes.default30),
                      child: Text(
                        '流水号',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 5,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      child: Text('44120211120143442112', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),),
                    ),
                  )
                ],
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              height: Sizes.default40,
              child: Row(
                children: [
                  Expanded(
                    flex: 3,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      padding: const EdgeInsets.only(left: Sizes.default30),
                      child: Text(
                        '当前余额',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 5,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      child: Text(balance.balance.toString(), style: StylesUtils.customTextStyle(color: ColorsUtils.color797),),
                    ),
                  )
                ],
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              height: Sizes.default40,
              child: Row(
                children: [
                  Expanded(
                    flex: 3,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      padding: const EdgeInsets.only(left: Sizes.default30),
                      child: Text(
                        '备注',
                        style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 5,
                    child: Container(
                      alignment: Alignment.centerLeft,
                      child: Text('${balance.payName} / 经营收款', style: StylesUtils.customTextStyle(color: ColorsUtils.color797),),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
